#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;
 
int open_file(ifstream &ifs, char *name){
    //ifstream ifs(name);
    ifs.open(name);
    if (!ifs.bad())
    {
        // Dump the contents of the file to cout.
        cout << ifs.rdbuf();
        ifs.close();
        return 1;
    }
    else{
        return 0;
    }
}
 
int main(int argc,char**argv)
{
    ifstream infile;
    cout << argc << endl;
    if(argc==2){
        cout << argv[1] << endl;
        if(!open_file(infile,argv[1])){
            cerr<<"No input file!"<<endl;
            return EXIT_FAILURE;
        }
    }
 
    // system("pause");
    return 0;
}